package model;

/**
 * Class for the specific node used for creating a supervisor for graph with variables
 * @author DarkoLaptop2
 *
 */
public class NodeUnfoldingTransitionSystem extends NodeTransitionSystem {

	private VariableHashTable variablesTable;
	
	
	/** The constructor of the class
	 * @param index - the indes of the node
	 * @param name - the name of the node
	 * @param variablesTable - the table with all the variables and their values
	 */
	public NodeUnfoldingTransitionSystem(int index, String name,VariableHashTable variablesTable) {
		super(index, name);
		this.variablesTable=variablesTable.copyHashTable();
	}
	
	/** 
	 * Equals of the objects - when they have the same name and the same variable values
	 *
	 **/
	@Override
	public boolean equals(Object obj2){
		NodeUnfoldingTransitionSystem node2=(NodeUnfoldingTransitionSystem) obj2;
		return name.equals(node2.name) && variablesTable.equals(node2.variablesTable);
	}

	
	/** Method for getting the variable values of this node
	 * @return Variable hash table values
	 */
	public VariableHashTable getVariablesTable() {
		return variablesTable;
	}
	
	/**
	 * Method for getting the full information for one node: the name and all of the neighbours
	 * 
	 * @return String - the string that contains all of the information of the node
	 */
	public String toStringWithNeightbours() {
		String ret= "[Name:"+name+" "+variablesTable.toString()+"] Neighbours:";
		for (EdgeTransitionSystem edge:neighbors)
		ret+="("+edge+") ";
		return ret;
		
	}
	
	/**
	 * Method used for printing of the node -
	 * @return String - information of the node
	 */
	@Override
	public String toString() {
		String ret= "[Name:"+name+" "+variablesTable.toString()+"]";
		return ret;
		
	}

}
